namespace Patterns4Net.Core
{
    using System.Collections.Generic;
    using System.Diagnostics.Contracts;
    using Mono.Cecil;
    using Patterns4Net.Attributes.DesignPatterns;
    using Patterns4Net.Core.Patterns;
    using Patterns4Net.Attributes;

    /// <summary>
    /// Represents strategy to get patterns meta-data from class type.
    /// </summary>
    [Strategy]
    [ContractClass(typeof(PatternsProviderContract))]
    public interface IPatternsProvider
    {
        IEnumerable<IPattern> GetPatterns<TMember>(TMember member) where TMember : IMemberDefinition;
    }

    [ContractClassFor(typeof(IPatternsProvider))]
    public abstract class PatternsProviderContract : IPatternsProvider
    {
        public IEnumerable<IPattern> GetPatterns<TMember>(TMember member) where TMember : IMemberDefinition
        {
            Contract.Requires(member != null);
            Contract.Ensures(Contract.Result<IEnumerable<IPattern>>() != null);
            return null;
        }
    }
}
